package yja.gzw.app.activity

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentPagerAdapter
import yja.gzw.app.R
import yja.gzw.app.base.BaseActivity
import yja.gzw.app.databinding.ActivityWodefabuBinding
import yja.gzw.app.fragmentview.FabuddFragment
import yja.gzw.app.fragmentview.FabudtFragment
import yja.gzw.app.fragmentview.HomeFragment
import yja.gzw.app.fragmentview.TuijianFragment
import yja.gzw.app.fragmentview.WodeFragment
import yja.gzw.app.fragmentview.XiaoxiFragment
import yja.gzw.app.viewmodel.Mainviewmodel
import com.google.android.material.tabs.TabLayout

class WodefabuActivity :BaseActivity<Mainviewmodel, ActivityWodefabuBinding>(R.layout.activity_wodefabu){

    val list_fragment= mutableListOf<Fragment>(
        FabuddFragment(), TuijianFragment()
    )
    val list_title= mutableListOf<String>("订单","动态")


    override fun initView() {
        binding.viewpager.adapter=object : FragmentPagerAdapter(supportFragmentManager){
            override fun getCount(): Int {

                return list_fragment.size

            }

            override fun getItem(position: Int): Fragment {

                return list_fragment[position]

            }

            override fun getPageTitle(position: Int): CharSequence{
                return list_title[position]
            }

        }
        binding.tabs.setupWithViewPager(binding.viewpager)

        binding.tabs.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
            override fun onTabSelected(tab: TabLayout.Tab) {


            }

            override fun onTabUnselected(tab: TabLayout.Tab) {


            }

            override fun onTabReselected(tab: TabLayout.Tab?) {

            }


        })


    }

    override fun dataObservese() {

    }
}